<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>在线答题系统</title>
</head>
<body>
	<h1 align="center">在线答题系统</h1>
	<h3>欢迎 <?php 
		session_start();
	if(isset($_SESSION["user"]))
		echo $_SESSION["user"];
	 ?> 同学！</h3>
	 <?php 
	 	//var_dump($data['test']);
	  ?>
	  <form method="post" action="index.php?c=index&m=addtestRtList" enctype="multipart/form-data">
	  	<table align="center" border="1">
	  	<tr>
	  		<th></th>
	  		<th>选项一</th>
	  		<th>选项二</th>
	  		<th>选项三</th>
	  		<th>选项四</th>
	  	</tr>
	  	<?php 
	  		//$i = 0;
	  		$pid = $_GET['pid'];
	  		//echo $pid;
	  		
	  		//echo $data['test'];
	  			$row=$data['test'];
	  			
	  			echo '<tr>';
	  			echo '<th>'.$row['type'].'</th></tr>';
	  			//echo "</br>";
	  			echo '<tr>';
	  			echo '<th>'.$row['content'].'</th></tr>';
	  			echo '<tr>';
	  			echo '<th></th>';
	  			echo '<th><img src="images/'.$row['pic1'].'" width=60 height=80 alt="无头像"></th>';
	  			echo '<th><img src="images/'.$row['pic2'].'" width=60 height=80 alt="无头像"></th>';
	  			echo '<th><img src="images/'.$row['pic3'].'" width=60 height=80 alt="无头像"></th>';
	  			echo '<th><img src="images/'.$row['pic4'].'" width=60 height=80 alt="无头像"></th>';
	  			echo '</tr>';
	  			echo '<tr>';
	  			echo '<th>选项</th>';
	  			echo '<th>'.$row['op1'].'</th>';
	  			echo '<th>'.$row['op2'].'</th>';
	  			echo '<th>'.$row['op3'].'</th>';
	  			echo '<th>'.$row['op4'].'</th>';
	  			echo '</tr>';
	  	
	  			echo '<tr>';
	  			echo '<th></th>';
	  			echo '<th><input type="radio" name="ans"  value="1" checked></th>';
	  			echo '<th><input type="radio" name="ans"  value="2" ></th>';
	  			echo '<th><input type="radio" name="ans"  value="3"></th>';
	  			echo '<th><input type="radio" name="ans"  value="4" ></th>';
	  			echo '</tr>';	
	  		
	  			echo '<tr>';
	  			echo '<th>选择你答的学科</th>';
	  		
	  			$sql="select * from papers";
				$result=mysql_query($sql);
				while($row=mysql_fetch_assoc($result))
				{
					if($pid == $row['pid'])
							echo "<th><input type='radio' name='pid' value='".$row['pid']."' checked>".$row['pname']."</th>";
					else
						echo "<th><input type='radio' name='pid' value='".$row['pid']."'>".$row['pname']."</th>";
					//通过GET得到PID与row数组中pid判断，相同即为选中

				}
	  			echo '<th></th>';
	  			echo '</tr>';
	  			
	  		
	  		echo '<tr>';
	  		echo '<th></th>';
	  		echo '<th><input type="submit"  value="提交"></th>';
	  		echo '<th><input type="reset"  value="重置"></th>';
	  		echo '</tr>';
	  		echo '</table>';
	  	 ?>
	  	 	
	  	 
	  </form>
</body>
</html>